// Configures a mathquestion after what level the current user is at.
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.chalmers.se.tda367.question;

/**
 *
 * @author Hanna
 */
public class MathQuestionConFig { // contains the methods to set at what level the questions should be, and how big part of each question the test should consist of

    public int maxXAddSub; // the maximum value that can be assigned to x and y for the addition- and subtractionquestions
    public int maxYAddSub;
    public int MaxXMulDiv;
    public int maxYMulDiv;
    public int partAdd; // what part additionsquestions the test should cosist of
    public int partSub;
    public int partMul;
    public int partDiv;
    public final int numberOfQuestions = 20; // how many questions the test should consist of

    public void setLevel(int i) {
        if (i == 1) {
            this.setFirstLevel();
        }
        if (i == 2) {
            this.setSecondLevel();
        }
        if (i == 3) {
            this.setThirdLevel();
        }
    }

    public void setFirstLevel() { // sets the level to easy/first grade
        maxXAddSub = 10;
        maxYAddSub = 10;
        partAdd = 50;
        partSub = 50;
        partMul = 0;
        partDiv = 0;
    }

    public void setSecondLevel() { // sets the level to medium/second grade
        maxXAddSub = 20;
        maxYAddSub = 20;
        MaxXMulDiv = 5;
        maxYMulDiv = 5;
        partAdd = 25;
        partSub = 25;
        partMul = 25;
        partDiv = 25;
    }

    public void setThirdLevel() { // sets the level to hard/third grade
        maxXAddSub = 100;
        maxYAddSub = 100;
        MaxXMulDiv = 10;
        maxYMulDiv = 10;
        partAdd = 25;
        partSub = 25;
        partMul = 25;
        partDiv = 25;
    }

    public void setAddQuestion(int level) { // sets the exercisequestion to addition
        if (level == 1) {    // the level is saved as an int in the user, and the method checks what level to set
            setFirstLevel();
        } else if (level == 2) {
            setSecondLevel();
        } else if (level == 3) {
            setThirdLevel();
        }
        partAdd = 1; // set so that the exercisecontroller knows which if to choose in nextQuestion()
    }

    public void setSubQuestion(int level) { // sets the exercisequestion to subtraction
        if (level == 1) {
            setFirstLevel();
        } else if (level == 2) {
            setSecondLevel();
        } else if (level == 3) {
            setThirdLevel();
        }
        partAdd = 0;
        partSub = 1;
    }

    public void setMulQuestion(int level) { // sets the exercisequestion to multiplication
        if (level == 1) {
            setFirstLevel();
        } else if (level == 2) {
            setSecondLevel();
        } else if (level == 3) {
            setThirdLevel();
        }
        partAdd = 0;
        partSub = 0;
        partMul = 1;
    }

    public void setDivQuestion(int level) { // sets the exercisequestion to divison
        if (level == 1) {
            setFirstLevel();
        } else if (level == 2) {
            setSecondLevel();
        } else if (level == 3) {
            setThirdLevel();
        }
        partAdd = 0;
        partSub = 0;
        partMul = 0;
        partDiv = 1;
    }
    // TODO: make it possible to create different kinds of question within an area
}
